﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Liger.Web.Common;
using Liger.Web.Common.Extensions;

namespace Liger.Web.UI
{
    public class WindowBuilder : UIComponentBuilderBase, IHideObjectMembers
    {
        private Window Window
        {
            get
            {
                return this.Component as Window;
            }
        }


        public WindowBuilder()
            : base(new Window())
        {

        }

        public WindowBuilder(Window Window)
            : base(Window)
        {

        }

        /// <summary>
        /// 设置属性
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public WindowBuilder Set(string property, object value)
        {
            if (this.Window.Properties.ContainsKey(property))
            {
                this.Window.Properties[property] = value;
            }
            else
            {
                this.Window.Properties.Add(property, value);
            }
            return this;
        }

        /// <summary>
        /// 返回ligerWindow的Manager
        /// </summary>
        /// <param name="manager">manager的对象名</param>
        /// <returns></returns>
        public WindowBuilder Manager(string manager)
        {
            this.Window.Manager = manager;
            return this;
        }


        public WindowBuilder ShowClose(bool value)
        {
            this.Window.ShowClose = value;
            return this;
        }
        public WindowBuilder ShowMax(bool value)
        {
            this.Window.ShowMax = value;
            return this;
        }
        public WindowBuilder ShowToggle(bool value)
        {
            this.Window.ShowToggle = value;
            return this;
        }
        public WindowBuilder ShowMin(bool value)
        {
            this.Window.ShowMin = value;
            return this;
        }
        public WindowBuilder Title(string value)
        {
            this.Window.Title = value;
            return this;
        }
        public WindowBuilder Load(bool value)
        {
            this.Window.Load = value;
            return this;
        }
        public WindowBuilder Modal(bool value)
        {
            this.Window.Modal = value;
            return this;
        }
    }
}